import React, { Component } from 'react'

export default class componentName extends Component {

	state={
		foodtype: '',
		description: ''
	}

	componentDidMount() {
		// console.log(this.props.leibie)
		this.setState({ ...this.props.leibie})

	}

	handelInput=(f,e)=>{
		// console.log (e.target.value)
		// console.log (f)
		// if(e.target.checked){
			this.setState({[f]: e.target.value})
		// }
	

	}

  render() {
		let { closeForm, saveHandle, updateInfo, isUpdate, deleteInfo } = this.props
		let { foodtype, description} = this.state

    return (
        <div>
					<div className="modal fade in" style={{ display: 'block' }}>
							<div className="modal-dialog">
									<div className="modal-content">
											<div className="modal-header">
													<button type="button" className="close" onClick={closeForm}>
															<span>×</span></button>
													<h4 className="modal-title">{isUpdate? '修改':'新增'}类别</h4>
											</div>
											<div className="modal-body">
													<div className="form-group">
															<label>类别名称：</label>
									            <input className='form-control' value={foodtype} type='text' onChange={this.handelInput.bind(null, 'foodtype')}/>
															<label>类别描述：</label>
															<textarea className="form-control" value={description} onChange={this.handelInput.bind(null, 'description')} style={{ overflowY: 'hidden' }}></textarea>
													</div>
											</div>
											<div className="modal-footer">
                          <button type="button" className="btn btn-default pull-left" onClick={closeForm}>取消</button>
													<button type="button" className="btn btn-primary" onClick={saveHandle.bind(null,this.state)}>提交</button>
											</div>
									</div>
							</div>
					</div>
        </div>

    )
  }
}
